Week 8 – Modularizing and Algorithm Improvements

Coding Period
Author

Nilay Verma

Published

July 7, 2025

Hey everyone! 👋

Another week, another update on my GSoC journey with ProLIF!


📝 Current Pull Request Status

The primary task this week involved modularizing the function used to calculate coordinates for protein residues and adjusting the algorithm to express the strength of interaction between the ligand and the protein.

The PR!


Splitting the function into smaller parts

The function has been split as follows:

  1. Extract indices: Get the indices of protein and ligand atoms from the df.

  2. Calculate diagram dimensions*: Get the center, width, and height of the diagram, calculated using the atoms from mol.GetConformer().GetPositions().

  3. Build NetworkX graph*: Create a NetworkX graph object with protein residues and ligand atoms as nodes. This might sound familiar 😉, as we added this as a separate feature to the LigNetwork class in week 3.

  4. Calculate initial positions*: Determine the initial positions for protein residues using the custom function I prepared in week 4.

  5. Apply spring layout: Pass all this information to NetworkX’s spring_layout:

    pos = nx.spring_layout(
        G,
        pos=pos,  # Initial positions for residues and fixed ligand atoms
        fixed=ligand_indices,  # Fix ligand atoms at their coordinates
        scale=2,  # Rescales the layout to a reasonable size
        iterations=100,
        center=center,
        weight="weight_spring_layout",
    )

    Note: weight_spring_layout is 10 / distance, where distance is the interaction distance between the ligand and the residue. We want residues with strong interactions to be close to the ligand, hence distance is in the denominator.

  6. Resolve overlaps*: Check for overlaps and push the overlapping residues apart. A new feature here is that the function now also checks for overlaps between residue and ligand atoms.

An asterisk signifies that the step has a separate function.


📆 What’s Next?

I’ll focus on completing the test file for the residue coordinates, which was on hold while I addressed these changes.


Thanks for reading and keeping up with my progress! More updates soon as we drive these visuals and tests forward. 🧬📊